package com.hmy.finance.service.receipt.dto.recharge;

import com.hmy.finance.api.common.enums.receipt.AccountTradeBusinessTypeEnum;
import com.hmy.finance.dal.po.RechargeTransactionBillPo;
import com.hmy.finance.service.receipt.dto.contactorAccount.ContactorIncomeDto;
import com.hmy.finance.service.receipt.rdto.recharge.RechargeTransactionBillRdto;
import lombok.Data;

/**
 * 回充业务单据费用到联系人余额
 *
 * @author songkf
 */
@Data
public class RechargeTransactionBillDto implements java.io.Serializable {
    private static final long serialVersionUID = 1305742699554969596L;

    //================= Request Parameters =================
    /**
     * 回充业务单据ID
     */
    private Long rechargeTransactionBillId;
    /**
     * 回充业务单据
     */
    private RechargeTransactionBillPo rechargeTransactionBill;


    //===================== Methods ======================

    public static RechargeTransactionBillDto getInstance(Long rechargeTransactionBillId) {
        RechargeTransactionBillDto rechargeTransactionBillDto = new RechargeTransactionBillDto();
        rechargeTransactionBillDto.setRechargeTransactionBillId(rechargeTransactionBillId);
        return rechargeTransactionBillDto;
    }

    public static RechargeTransactionBillDto getInstance(RechargeTransactionBillPo rechargeTransactionBill) {
        RechargeTransactionBillDto rechargeTransactionBillDto = new RechargeTransactionBillDto();
        rechargeTransactionBillDto.setRechargeTransactionBill(rechargeTransactionBill);
        return rechargeTransactionBillDto;
    }

    public ContactorIncomeDto getContactorIncomeDto() {
        ContactorIncomeDto contactorIncomeDto = new ContactorIncomeDto();
        contactorIncomeDto.setAmount(rechargeTransactionBill.getRechargeTotalAmount());
        contactorIncomeDto.setBusinessBillId(rechargeTransactionBill.getBillId());
        contactorIncomeDto.setBusinessType(AccountTradeBusinessTypeEnum.RECHARGE);
        contactorIncomeDto.setCustomerContactorId(rechargeTransactionBill.getContactorId());
        contactorIncomeDto.setFeeIncurredTime(rechargeTransactionBill.getCreateTime());
        return contactorIncomeDto;
    }

    public RechargeTransactionBillRdto getRdto(Boolean result) {
        RechargeTransactionBillRdto rechargeTransactionBillRdto = new RechargeTransactionBillRdto();
        rechargeTransactionBillRdto.setRechargeAmount(rechargeTransactionBill.getRechargeTotalAmount());
        rechargeTransactionBillRdto.setRechargeTransactionBillId(rechargeTransactionBill.getBillId());
        rechargeTransactionBillRdto.setRechargeResult(result);
        return rechargeTransactionBillRdto;
    }
}
